<template lang="html">
  <a-layout class="travel-dynamics table" style="background: #f0f0f0;">
    <div class="table__left">
      <div class="table-img" @click="goTravel">
        <!-- <img src="@/assets/05.jpg" alt="image"> -->
        <img :src="`proxy/Ecp.Picture.getNoCheckView.img?pictureId=${image.FPhoto}`" :alt="image.FPhotoTitle">
        <span></span>
        <p v-html="image.FTitle"></p>
      </div>
    </div>
    <div class="table__right">
      <div class="table-list" style="flex: 1;">
        <div class="list__title" v-html="newsListData.title"></div>
        <a class="more" @click="golist(newsListData)">更多 <a-icon type="double-right" /></a>
        <ul class="list__content">
          <li class="list__content-item" v-for="item in newsListData.data" @click="goDetail(item, newsListData)">
            <div class="item__title" v-html="item.FTitle"></div>
            <div class="item__date" v-html="item.FDate"></div>
          </li>
        </ul>
      </div>
      <div class="table-list" style="flex: 1;">
        <div class="list__title" v-html="holidayListData.title"></div>
        <a class="more" @click="golist(holidayListData)">更多 <a-icon type="double-right" /></a>
        <ul class="list__content">
          <li class="list__content-item" v-for="item in holidayListData.data" @click="goDetail(item, holidayListData)">
            <div class="item__title" v-html="item.FTitle"></div>
            <div class="item__date" v-html="item.FDate"></div>
          </li>
        </ul>
      </div>
    </div>
  </a-layout>
</template>

<script>
import {invoke} from '@/api';
export default {
  data () {
    return {
      parentTitle: "旅游动态",
      parentURL: "/",
      newsListData: {
        title: "头条新闻",
        url: "api/WTM.TopNews.perpareNotCheckEdit",
        pageCode: "WTM.TopNews.Edit",
        data: []
      },
      travelListData: {
        title: "旅游动态",
        url: "api/WTM.TravelDynamics.getNotCheckList",
        pageCode: "WTM.TravelDynamics.List",
        data: []
      },
      holidayListData: {
        title: "精彩节庆",
        url: "api/WTM.WonderfulFestival.perpareNotCheckEdit",
        pageCode: "WTM.WonderfulFestival.Edit",
        data: []
      },
      image: {}
    }
  },
  mounted() {
    this.loadData()
  },
  methods: {
    goDetail(item, list) {
      this.$router.push({
        path: '/info-page',
        query: {
          FId: item.FId,
          parentTitle: this.parentTitle,
          parentURL: this.parentURL,
          FTitle: list.title,
          url: list.url,
          pageCode: list.pageCode
        }
      })
    },
    loadData() {
      invoke("api/WTM.TravelDynamics.getNotCheckList",{
        pageCode: "WTM.TravelDynamics.List"
      }).then((res) => {
        this.image = {}
        this.image = res.records[0]
      })
      invoke("api/WTM.TopNews.getNotCheckList",{
        pageCode: "WTM.TopNews.List",
        pageSize: 4
      }).then((res) => {
        this.newsListData.data = []
        this.newsListData.data = res.records
      })
      invoke("api/WTM.WonderfulFestival.getNotCheckList",{
        pageCode: "WTM.WonderfulFestival.List",
        pageSize: 4
      }).then((res) => {
        this.holidayListData.data = []
        this.holidayListData.data = res.records
      })
    },
    golist(list) {
      this.$router.push({
        path: "/list-page",
        query: {
          parentTitle: this.parentTitle,
          parentURL: this.parentURL,
          FTitle: list.title,
          url: list.url,
          pageCode: list.pageCode,
          listURL: list.url,
          listPageCode: list.pageCode
        }
      })
    },
    goTravel() {
      this.$router.push({
        path: "/list-page",
        query: {
          parentTitle: this.parentTitle,
          parentURL: this.parentURL,
          FTitle: this.travelListData.title,
          url: "api/WTM.TravelDynamics.perpareNotCheckEdit",
          pageCode: "WTM.TravelDynamics.Edit",
          listURL: this.travelListData.url,
          listPageCode: this.travelListData.pageCode
        }
      })
    }
  }
}
</script>

<style lang="scss">
</style>
